1 module directx.dwrite_1; 2 //+-------------------------------------------------------------------------- 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // Abstract: 7 // DirectX Typography Services public API definitions. 8 // 9 //---------------------------------------------------------------------------- 10 11 version(Windows): 12 version(DirectWrite): 13 14 public import directx.dwrite; 15 16 /// <summary> 17 /// The overall kind of family. 18 /// </summary> 19 alias DWRITE_PANOSE_FAMILY = int; 20 enum : DWRITE_PANOSE_FAMILY 21 { 22 DWRITE_PANOSE_FAMILY_ANY = 0, 23 DWRITE_PANOSE_FAMILY_NO_FIT = 1, 24 DWRITE_PANOSE_FAMILY_TEXT_DISPLAY = 2, 25 DWRITE_PANOSE_FAMILY_SCRIPT = 3, // or hand written 26 DWRITE_PANOSE_FAMILY_DECORATIVE = 4, 27 DWRITE_PANOSE_FAMILY_SYMBOL = 5, // or symbol 28 DWRITE_PANOSE_FAMILY_PICTORIAL = DWRITE_PANOSE_FAMILY_SYMBOL 29 } 30 31 /// <summary> 32 /// Appearance of the serifs. 33 /// Present for families: 2-text 34 /// </summary> 35 alias DWRITE_PANOSE_SERIF_STYLE = int; 36 enum : DWRITE_PANOSE_SERIF_STYLE 37 { 38 DWRITE_PANOSE_SERIF_STYLE_ANY = 0, 39 DWRITE_PANOSE_SERIF_STYLE_NO_FIT = 1, 40 DWRITE_PANOSE_SERIF_STYLE_COVE = 2, 41 DWRITE_PANOSE_SERIF_STYLE_OBTUSE_COVE = 3, 42 DWRITE_PANOSE_SERIF_STYLE_SQUARE_COVE = 4, 43 DWRITE_PANOSE_SERIF_STYLE_OBTUSE_SQUARE_COVE = 5, 44 DWRITE_PANOSE_SERIF_STYLE_SQUARE = 6, 45 DWRITE_PANOSE_SERIF_STYLE_THIN = 7, 46 DWRITE_PANOSE_SERIF_STYLE_OVAL = 8, 47 DWRITE_PANOSE_SERIF_STYLE_EXAGGERATED = 9, 48 DWRITE_PANOSE_SERIF_STYLE_TRIANGLE = 10, 49 DWRITE_PANOSE_SERIF_STYLE_NORMAL_SANS = 11, 50 DWRITE_PANOSE_SERIF_STYLE_OBTUSE_SANS = 12, 51 DWRITE_PANOSE_SERIF_STYLE_PERPENDICULAR_SANS = 13, 52 DWRITE_PANOSE_SERIF_STYLE_FLARED = 14, 53 DWRITE_PANOSE_SERIF_STYLE_ROUNDED = 15, 54 DWRITE_PANOSE_SERIF_STYLE_SCRIPT = 16, 55 DWRITE_PANOSE_SERIF_STYLE_PERP_SANS = DWRITE_PANOSE_SERIF_STYLE_PERPENDICULAR_SANS, 56 DWRITE_PANOSE_SERIF_STYLE_BONE = DWRITE_PANOSE_SERIF_STYLE_OVAL 57 } 58 59 /// <summary> 60 /// PANOSE font weights. These roughly correspond to the DWRITE_FONT_WEIGHT's 61 /// using (panose_weight - 2) * 100. 62 /// Present for families: 2-text, 3-script, 4-decorative, 5-symbol 63 /// </summary> 64 alias DWRITE_PANOSE_WEIGHT = int; 65 enum : DWRITE_PANOSE_WEIGHT 66 { 67 DWRITE_PANOSE_WEIGHT_ANY = 0, 68 DWRITE_PANOSE_WEIGHT_NO_FIT = 1, 69 DWRITE_PANOSE_WEIGHT_VERY_LIGHT = 2, 70 DWRITE_PANOSE_WEIGHT_LIGHT = 3, 71 DWRITE_PANOSE_WEIGHT_THIN = 4, 72 DWRITE_PANOSE_WEIGHT_BOOK = 5, 73 DWRITE_PANOSE_WEIGHT_MEDIUM = 6, 74 DWRITE_PANOSE_WEIGHT_DEMI = 7, 75 DWRITE_PANOSE_WEIGHT_BOLD = 8, 76 DWRITE_PANOSE_WEIGHT_HEAVY = 9, 77 DWRITE_PANOSE_WEIGHT_BLACK = 10, 78 DWRITE_PANOSE_WEIGHT_EXTRA_BLACK = 11, 79 DWRITE_PANOSE_WEIGHT_NORD = DWRITE_PANOSE_WEIGHT_EXTRA_BLACK 80 } 81 82 /// <summary> 83 /// Proportion of the glyph shape considering additional detail to standard 84 /// characters. 85 /// Present for families: 2-text 86 /// </summary> 87 alias DWORD DWRITE_PANOSE_PROPORTION; 88 enum : DWRITE_PANOSE_PROPORTION 89 { 90 DWRITE_PANOSE_PROPORTION_ANY = 0, 91 DWRITE_PANOSE_PROPORTION_NO_FIT = 1, 92 DWRITE_PANOSE_PROPORTION_OLD_STYLE = 2, 93 DWRITE_PANOSE_PROPORTION_MODERN = 3, 94 DWRITE_PANOSE_PROPORTION_EVEN_WIDTH = 4, 95 DWRITE_PANOSE_PROPORTION_EXPANDED = 5, 96 DWRITE_PANOSE_PROPORTION_CONDENSED = 6, 97 DWRITE_PANOSE_PROPORTION_VERY_EXPANDED = 7, 98 DWRITE_PANOSE_PROPORTION_VERY_CONDENSED = 8, 99 DWRITE_PANOSE_PROPORTION_MONOSPACED = 9 100 } 101 102 /// <summary> 103 /// Ratio between thickest and thinnest point of the stroke for a letter such 104 /// as uppercase 'O'. 105 /// Present for families: 2-text, 3-script, 4-decorative 106 /// </summary> 107 alias DWRITE_PANOSE_CONTRAST = int; 108 enum : DWRITE_PANOSE_CONTRAST 109 { 110 DWRITE_PANOSE_CONTRAST_ANY = 0, 111 DWRITE_PANOSE_CONTRAST_NO_FIT = 1, 112 DWRITE_PANOSE_CONTRAST_NONE = 2, 113 DWRITE_PANOSE_CONTRAST_VERY_LOW = 3, 114 DWRITE_PANOSE_CONTRAST_LOW = 4, 115 DWRITE_PANOSE_CONTRAST_MEDIUM_LOW = 5, 116 DWRITE_PANOSE_CONTRAST_MEDIUM = 6, 117 DWRITE_PANOSE_CONTRAST_MEDIUM_HIGH = 7, 118 DWRITE_PANOSE_CONTRAST_HIGH = 8, 119 DWRITE_PANOSE_CONTRAST_VERY_HIGH = 9, 120 DWRITE_PANOSE_CONTRAST_HORIZONTAL_LOW = 10, 121 DWRITE_PANOSE_CONTRAST_HORIZONTAL_MEDIUM = 11, 122 DWRITE_PANOSE_CONTRAST_HORIZONTAL_HIGH = 12, 123 DWRITE_PANOSE_CONTRAST_BROKEN = 13 124 } 125 126 /// <summary> 127 /// Relationship between thin and thick stems. 128 /// Present for families: 2-text 129 /// </summary> 130 alias DWRITE_PANOSE_STROKE_VARIATION = int; 131 enum : DWRITE_PANOSE_STROKE_VARIATION 132 { 133 DWRITE_PANOSE_STROKE_VARIATION_ANY = 0, 134 DWRITE_PANOSE_STROKE_VARIATION_NO_FIT = 1, 135 DWRITE_PANOSE_STROKE_VARIATION_NO_VARIATION = 2, 136 DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_DIAGONAL = 3, 137 DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_TRANSITIONAL = 4, 138 DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_VERTICAL = 5, 139 DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_HORIZONTAL = 6, 140 DWRITE_PANOSE_STROKE_VARIATION_RAPID_VERTICAL = 7, 141 DWRITE_PANOSE_STROKE_VARIATION_RAPID_HORIZONTAL = 8, 142 DWRITE_PANOSE_STROKE_VARIATION_INSTANT_VERTICAL = 9, 143 DWRITE_PANOSE_STROKE_VARIATION_INSTANT_HORIZONTAL = 10 144 } 145 146 /// <summary> 147 /// Style of termination of stems and rounded letterforms. 148 /// Present for families: 2-text 149 /// </summary> 150 alias DWRITE_PANOSE_ARM_STYLE = int; 151 enum : DWRITE_PANOSE_ARM_STYLE 152 { 153 DWRITE_PANOSE_ARM_STYLE_ANY = 0, 154 DWRITE_PANOSE_ARM_STYLE_NO_FIT = 1, 155 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORIZONTAL = 2, 156 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_WEDGE = 3, 157 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERTICAL = 4, 158 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_SINGLE_SERIF = 5, 159 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_DOUBLE_SERIF = 6, 160 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_HORIZONTAL = 7, 161 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_WEDGE = 8, 162 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_VERTICAL = 9, 163 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_SINGLE_SERIF = 10, 164 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_DOUBLE_SERIF = 11, 165 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORZ = DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORIZONTAL, 166 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERT = DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERTICAL, 167 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_HORZ = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_HORIZONTAL, 168 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_WEDGE = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_WEDGE, 169 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_VERT = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_VERTICAL, 170 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_SINGLE_SERIF = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_SINGLE_SERIF, 171 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_DOUBLE_SERIF = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_DOUBLE_SERIF 172 } 173 174 /// <summary> 175 /// Roundness of letterform. 176 /// Present for families: 2-text 177 /// </summary> 178 alias DWRITE_PANOSE_LETTERFORM = int; 179 enum : DWRITE_PANOSE_LETTERFORM 180 { 181 DWRITE_PANOSE_LETTERFORM_ANY = 0, 182 DWRITE_PANOSE_LETTERFORM_NO_FIT = 1, 183 DWRITE_PANOSE_LETTERFORM_NORMAL_CONTACT = 2, 184 DWRITE_PANOSE_LETTERFORM_NORMAL_WEIGHTED = 3, 185 DWRITE_PANOSE_LETTERFORM_NORMAL_BOXED = 4, 186 DWRITE_PANOSE_LETTERFORM_NORMAL_FLATTENED = 5, 187 DWRITE_PANOSE_LETTERFORM_NORMAL_ROUNDED = 6, 188 DWRITE_PANOSE_LETTERFORM_NORMAL_OFF_CENTER = 7, 189 DWRITE_PANOSE_LETTERFORM_NORMAL_SQUARE = 8, 190 DWRITE_PANOSE_LETTERFORM_OBLIQUE_CONTACT = 9, 191 DWRITE_PANOSE_LETTERFORM_OBLIQUE_WEIGHTED = 10, 192 DWRITE_PANOSE_LETTERFORM_OBLIQUE_BOXED = 11, 193 DWRITE_PANOSE_LETTERFORM_OBLIQUE_FLATTENED = 12, 194 DWRITE_PANOSE_LETTERFORM_OBLIQUE_ROUNDED = 13, 195 DWRITE_PANOSE_LETTERFORM_OBLIQUE_OFF_CENTER = 14, 196 DWRITE_PANOSE_LETTERFORM_OBLIQUE_SQUARE = 15 197 } 198 199 /// <summary> 200 /// Placement of midline across uppercase characters and treatment of diagonal 201 /// stem apexes. 202 /// Present for families: 2-text 203 /// </summary> 204 alias DWRITE_PANOSE_MIDLINE = int; 205 enum : DWRITE_PANOSE_MIDLINE 206 { 207 DWRITE_PANOSE_MIDLINE_ANY = 0, 208 DWRITE_PANOSE_MIDLINE_NO_FIT = 1, 209 DWRITE_PANOSE_MIDLINE_STANDARD_TRIMMED = 2, 210 DWRITE_PANOSE_MIDLINE_STANDARD_POINTED = 3, 211 DWRITE_PANOSE_MIDLINE_STANDARD_SERIFED = 4, 212 DWRITE_PANOSE_MIDLINE_HIGH_TRIMMED = 5, 213 DWRITE_PANOSE_MIDLINE_HIGH_POINTED = 6, 214 DWRITE_PANOSE_MIDLINE_HIGH_SERIFED = 7, 215 DWRITE_PANOSE_MIDLINE_CONSTANT_TRIMMED = 8, 216 DWRITE_PANOSE_MIDLINE_CONSTANT_POINTED = 9, 217 DWRITE_PANOSE_MIDLINE_CONSTANT_SERIFED = 10, 218 DWRITE_PANOSE_MIDLINE_LOW_TRIMMED = 11, 219 DWRITE_PANOSE_MIDLINE_LOW_POINTED = 12, 220 DWRITE_PANOSE_MIDLINE_LOW_SERIFED = 13 221 } 222 223 /// <summary> 224 /// Relative size of lowercase letters and treament of diacritic marks 225 /// and uppercase glyphs. 226 /// Present for families: 2-text 227 /// </summary> 228 alias DWRITE_PANOSE_XHEIGHT = int; 229 enum : DWRITE_PANOSE_XHEIGHT 230 { 231 DWRITE_PANOSE_XHEIGHT_ANY = 0, 232 DWRITE_PANOSE_XHEIGHT_NO_FIT = 1, 233 DWRITE_PANOSE_XHEIGHT_CONSTANT_SMALL = 2, 234 DWRITE_PANOSE_XHEIGHT_CONSTANT_STANDARD = 3, 235 DWRITE_PANOSE_XHEIGHT_CONSTANT_LARGE = 4, 236 DWRITE_PANOSE_XHEIGHT_DUCKING_SMALL = 5, 237 DWRITE_PANOSE_XHEIGHT_DUCKING_STANDARD = 6, 238 DWRITE_PANOSE_XHEIGHT_DUCKING_LARGE = 7, 239 DWRITE_PANOSE_XHEIGHT_CONSTANT_STD = DWRITE_PANOSE_XHEIGHT_CONSTANT_STANDARD, 240 DWRITE_PANOSE_XHEIGHT_DUCKING_STD = DWRITE_PANOSE_XHEIGHT_DUCKING_STANDARD 241 } 242 243 /// <summary> 244 /// Kind of tool used to create character forms. 245 /// Present for families: 3-script 246 /// </summary> 247 alias DWRITE_PANOSE_TOOL_KIND = int; 248 enum : DWRITE_PANOSE_TOOL_KIND 249 { 250 DWRITE_PANOSE_TOOL_KIND_ANY = 0, 251 DWRITE_PANOSE_TOOL_KIND_NO_FIT = 1, 252 DWRITE_PANOSE_TOOL_KIND_FLAT_NIB = 2, 253 DWRITE_PANOSE_TOOL_KIND_PRESSURE_POINT = 3, 254 DWRITE_PANOSE_TOOL_KIND_ENGRAVED = 4, 255 DWRITE_PANOSE_TOOL_KIND_BALL = 5, 256 DWRITE_PANOSE_TOOL_KIND_BRUSH = 6, 257 DWRITE_PANOSE_TOOL_KIND_ROUGH = 7, 258 DWRITE_PANOSE_TOOL_KIND_FELT_PEN_BRUSH_TIP = 8, 259 DWRITE_PANOSE_TOOL_KIND_WILD_BRUSH = 9 260 } 261 262 /// <summary> 263 /// Monospace vs proportional. 264 /// Present for families: 3-script, 5-symbol 265 /// </summary> 266 alias DWRITE_PANOSE_SPACING = int; 267 enum : DWRITE_PANOSE_SPACING 268 { 269 DWRITE_PANOSE_SPACING_ANY = 0, 270 DWRITE_PANOSE_SPACING_NO_FIT = 1, 271 DWRITE_PANOSE_SPACING_PROPORTIONAL_SPACED = 2, 272 DWRITE_PANOSE_SPACING_MONOSPACED = 3, 273 } 274 275 /// <summary> 276 /// Ratio between width and height of the face. 277 /// Present for families: 3-script 278 /// </summary> 279 alias DWRITE_PANOSE_ASPECT_RATIO = int; 280 enum : DWRITE_PANOSE_ASPECT_RATIO 281 { 282 DWRITE_PANOSE_ASPECT_RATIO_ANY = 0, 283 DWRITE_PANOSE_ASPECT_RATIO_NO_FIT = 1, 284 DWRITE_PANOSE_ASPECT_RATIO_VERY_CONDENSED = 2, 285 DWRITE_PANOSE_ASPECT_RATIO_CONDENSED = 3, 286 DWRITE_PANOSE_ASPECT_RATIO_NORMAL = 4, 287 DWRITE_PANOSE_ASPECT_RATIO_EXPANDED = 5, 288 DWRITE_PANOSE_ASPECT_RATIO_VERY_EXPANDED = 6 289 } 290 291 /// <summary> 292 /// Topology of letterforms. 293 /// Present for families: 3-script 294 /// </summary> 295 alias DWRITE_PANOSE_SCRIPT_TOPOLOGY = int; 296 enum : DWRITE_PANOSE_SCRIPT_TOPOLOGY 297 { 298 DWRITE_PANOSE_SCRIPT_TOPOLOGY_ANY = 0, 299 DWRITE_PANOSE_SCRIPT_TOPOLOGY_NO_FIT = 1, 300 DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_DISCONNECTED = 2, 301 DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_TRAILING = 3, 302 DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_CONNECTED = 4, 303 DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_DISCONNECTED = 5, 304 DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_TRAILING = 6, 305 DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_CONNECTED = 7, 306 DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_DISCONNECTED = 8, 307 DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_TRAILING = 9, 308 DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_CONNECTED = 10 309 } 310 311 /// <summary> 312 /// General look of the face, considering slope and tails. 313 /// Present for families: 3-script 314 /// </summary> 315 alias DWRITE_PANOSE_SCRIPT_FORM = int; 316 enum : DWRITE_PANOSE_SCRIPT_FORM 317 { 318 DWRITE_PANOSE_SCRIPT_FORM_ANY = 0, 319 DWRITE_PANOSE_SCRIPT_FORM_NO_FIT = 1, 320 DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_NO_WRAPPING = 2, 321 DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_SOME_WRAPPING = 3, 322 DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_MORE_WRAPPING = 4, 323 DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_EXTREME_WRAPPING = 5, 324 DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_NO_WRAPPING = 6, 325 DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_SOME_WRAPPING = 7, 326 DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_MORE_WRAPPING = 8, 327 DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_EXTREME_WRAPPING = 9, 328 DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_NO_WRAPPING = 10, 329 DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_SOME_WRAPPING = 11, 330 DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_MORE_WRAPPING = 12, 331 DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_EXTREME_WRAPPING = 13 332 } 333 334 /// <summary> 335 /// How character ends and miniscule ascenders are treated. 336 /// Present for families: 3-script 337 /// </summary> 338 alias DWRITE_PANOSE_FINIALS = int; 339 enum : DWRITE_PANOSE_FINIALS 340 { 341 DWRITE_PANOSE_FINIALS_ANY = 0, 342 DWRITE_PANOSE_FINIALS_NO_FIT = 1, 343 DWRITE_PANOSE_FINIALS_NONE_NO_LOOPS = 2, 344 DWRITE_PANOSE_FINIALS_NONE_CLOSED_LOOPS = 3, 345 DWRITE_PANOSE_FINIALS_NONE_OPEN_LOOPS = 4, 346 DWRITE_PANOSE_FINIALS_SHARP_NO_LOOPS = 5, 347 DWRITE_PANOSE_FINIALS_SHARP_CLOSED_LOOPS = 6, 348 DWRITE_PANOSE_FINIALS_SHARP_OPEN_LOOPS = 7, 349 DWRITE_PANOSE_FINIALS_TAPERED_NO_LOOPS = 8, 350 DWRITE_PANOSE_FINIALS_TAPERED_CLOSED_LOOPS = 9, 351 DWRITE_PANOSE_FINIALS_TAPERED_OPEN_LOOPS = 10, 352 DWRITE_PANOSE_FINIALS_ROUND_NO_LOOPS = 11, 353 DWRITE_PANOSE_FINIALS_ROUND_CLOSED_LOOPS = 12, 354 DWRITE_PANOSE_FINIALS_ROUND_OPEN_LOOPS = 13 355 } 356 357 /// <summary> 358 /// Relative size of the lowercase letters. 359 /// Present for families: 3-script 360 /// </summary> 361 alias DWRITE_PANOSE_XASCENT = int; 362 enum : DWRITE_PANOSE_XASCENT 363 { 364 DWRITE_PANOSE_XASCENT_ANY = 0, 365 DWRITE_PANOSE_XASCENT_NO_FIT = 1, 366 DWRITE_PANOSE_XASCENT_VERY_LOW = 2, 367 DWRITE_PANOSE_XASCENT_LOW = 3, 368 DWRITE_PANOSE_XASCENT_MEDIUM = 4, 369 DWRITE_PANOSE_XASCENT_HIGH = 5, 370 DWRITE_PANOSE_XASCENT_VERY_HIGH = 6 371 } 372 373 /// <summary> 374 /// General look of the face. 375 /// Present for families: 4-decorative 376 /// </summary> 377 alias DWRITE_PANOSE_DECORATIVE_CLASS = int; 378 enum : DWRITE_PANOSE_DECORATIVE_CLASS 379 { 380 DWRITE_PANOSE_DECORATIVE_CLASS_ANY = 0, 381 DWRITE_PANOSE_DECORATIVE_CLASS_NO_FIT = 1, 382 DWRITE_PANOSE_DECORATIVE_CLASS_DERIVATIVE = 2, 383 DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_TOPOLOGY = 3, 384 DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_ELEMENTS = 4, 385 DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_ASPECT = 5, 386 DWRITE_PANOSE_DECORATIVE_CLASS_INITIALS = 6, 387 DWRITE_PANOSE_DECORATIVE_CLASS_CARTOON = 7, 388 DWRITE_PANOSE_DECORATIVE_CLASS_PICTURE_STEMS = 8, 389 DWRITE_PANOSE_DECORATIVE_CLASS_ORNAMENTED = 9, 390 DWRITE_PANOSE_DECORATIVE_CLASS_TEXT_AND_BACKGROUND = 10, 391 DWRITE_PANOSE_DECORATIVE_CLASS_COLLAGE = 11, 392 DWRITE_PANOSE_DECORATIVE_CLASS_MONTAGE = 12 393 } 394 395 /// <summary> 396 /// Ratio between the width and height of the face. 397 /// Present for families: 4-decorative 398 /// </summary> 399 alias DWRITE_PANOSE_ASPECT = int; 400 enum : DWRITE_PANOSE_ASPECT 401 { 402 DWRITE_PANOSE_ASPECT_ANY = 0, 403 DWRITE_PANOSE_ASPECT_NO_FIT = 1, 404 DWRITE_PANOSE_ASPECT_SUPER_CONDENSED = 2, 405 DWRITE_PANOSE_ASPECT_VERY_CONDENSED = 3, 406 DWRITE_PANOSE_ASPECT_CONDENSED = 4, 407 DWRITE_PANOSE_ASPECT_NORMAL = 5, 408 DWRITE_PANOSE_ASPECT_EXTENDED = 6, 409 DWRITE_PANOSE_ASPECT_VERY_EXTENDED = 7, 410 DWRITE_PANOSE_ASPECT_SUPER_EXTENDED = 8, 411 DWRITE_PANOSE_ASPECT_MONOSPACED = 9 412 } 413 414 /// <summary> 415 /// Type of fill/line (treatment). 416 /// Present for families: 4-decorative 417 /// </summary> 418 alias DWRITE_PANOSE_FILL = int; 419 enum : DWRITE_PANOSE_FILL 420 { 421 DWRITE_PANOSE_FILL_ANY = 0, 422 DWRITE_PANOSE_FILL_NO_FIT = 1, 423 DWRITE_PANOSE_FILL_STANDARD_SOLID_FILL = 2, 424 DWRITE_PANOSE_FILL_NO_FILL = 3, 425 DWRITE_PANOSE_FILL_PATTERNED_FILL = 4, 426 DWRITE_PANOSE_FILL_COMPLEX_FILL = 5, 427 DWRITE_PANOSE_FILL_SHAPED_FILL = 6, 428 DWRITE_PANOSE_FILL_DRAWN_DISTRESSED = 7, 429 } 430 431 /// <summary> 432 /// Outline handling. 433 /// Present for families: 4-decorative 434 /// </summary> 435 alias DWRITE_PANOSE_LINING = int; 436 enum : DWRITE_PANOSE_LINING 437 { 438 DWRITE_PANOSE_LINING_ANY = 0, 439 DWRITE_PANOSE_LINING_NO_FIT = 1, 440 DWRITE_PANOSE_LINING_NONE = 2, 441 DWRITE_PANOSE_LINING_INLINE = 3, 442 DWRITE_PANOSE_LINING_OUTLINE = 4, 443 DWRITE_PANOSE_LINING_ENGRAVED = 5, 444 DWRITE_PANOSE_LINING_SHADOW = 6, 445 DWRITE_PANOSE_LINING_RELIEF = 7, 446 DWRITE_PANOSE_LINING_BACKDROP = 8 447 } 448 449 /// <summary> 450 /// Overall shape characteristics of the font. 451 /// Present for families: 4-decorative 452 /// </summary> 453 alias DWRITE_PANOSE_DECORATIVE_TOPOLOGY = int; 454 enum : DWRITE_PANOSE_DECORATIVE_TOPOLOGY 455 { 456 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_ANY = 0, 457 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_NO_FIT = 1, 458 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_STANDARD = 2, 459 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_SQUARE = 3, 460 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_MULTIPLE_SEGMENT = 4, 461 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_ART_DECO = 5, 462 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_UNEVEN_WEIGHTING = 6, 463 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_DIVERSE_ARMS = 7, 464 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_DIVERSE_FORMS = 8, 465 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_LOMBARDIC_FORMS = 9, 466 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_UPPER_CASE_IN_LOWER_CASE = 10, 467 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_IMPLIED_TOPOLOGY = 11, 468 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_HORSESHOE_E_AND_A = 12, 469 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_CURSIVE = 13, 470 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_BLACKLETTER = 14, 471 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_SWASH_VARIANCE = 15 472 } 473 474 /// <summary> 475 /// Type of characters available in the font. 476 /// Present for families: 4-decorative 477 /// </summary> 478 alias DWRITE_PANOSE_CHARACTER_RANGES = int; 479 enum : DWRITE_PANOSE_CHARACTER_RANGES 480 { 481 DWRITE_PANOSE_CHARACTER_RANGES_ANY = 0, 482 DWRITE_PANOSE_CHARACTER_RANGES_NO_FIT = 1, 483 DWRITE_PANOSE_CHARACTER_RANGES_EXTENDED_COLLECTION = 2, 484 DWRITE_PANOSE_CHARACTER_RANGES_LITERALS = 3, 485 DWRITE_PANOSE_CHARACTER_RANGES_NO_LOWER_CASE = 4, 486 DWRITE_PANOSE_CHARACTER_RANGES_SMALL_CAPS = 5 487 } 488 489 /// <summary> 490 /// Kind of symbol set. 491 /// Present for families: 5-symbol 492 /// </summary> 493 alias DWRITE_PANOSE_SYMBOL_KIND = int; 494 enum : DWRITE_PANOSE_SYMBOL_KIND 495 { 496 DWRITE_PANOSE_SYMBOL_KIND_ANY = 0, 497 DWRITE_PANOSE_SYMBOL_KIND_NO_FIT = 1, 498 DWRITE_PANOSE_SYMBOL_KIND_MONTAGES = 2, 499 DWRITE_PANOSE_SYMBOL_KIND_PICTURES = 3, 500 DWRITE_PANOSE_SYMBOL_KIND_SHAPES = 4, 501 DWRITE_PANOSE_SYMBOL_KIND_SCIENTIFIC = 5, 502 DWRITE_PANOSE_SYMBOL_KIND_MUSIC = 6, 503 DWRITE_PANOSE_SYMBOL_KIND_EXPERT = 7, 504 DWRITE_PANOSE_SYMBOL_KIND_PATTERNS = 8, 505 DWRITE_PANOSE_SYMBOL_KIND_BOARDERS = 9, 506 DWRITE_PANOSE_SYMBOL_KIND_ICONS = 10, 507 DWRITE_PANOSE_SYMBOL_KIND_LOGOS = 11, 508 DWRITE_PANOSE_SYMBOL_KIND_INDUSTRY_SPECIFIC = 12 509 } 510 511 /// <summary> 512 /// Aspect ratio of symbolic characters. 513 /// Present for families: 5-symbol 514 /// </summary> 515 alias DWRITE_PANOSE_SYMBOL_ASPECT_RATIO = int; 516 enum : DWRITE_PANOSE_SYMBOL_ASPECT_RATIO 517 { 518 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_ANY = 0, 519 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NO_FIT = 1, 520 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NO_WIDTH = 2, 521 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_EXCEPTIONALLY_WIDE = 3, 522 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_SUPER_WIDE = 4, 523 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_VERY_WIDE = 5, 524 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_WIDE = 6, 525 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NORMAL = 7, 526 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NARROW = 8, 527 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_VERY_NARROW = 9 528 } 529 530 /// <summary> 531 /// Specifies the policy used by GetRecommendedRenderingMode to determine whether to 532 /// render glyphs in outline mode. Glyphs are rendered in outline mode by default at 533 /// large sizes for performance reasons, but how large (i.e., the outline threshold) 534 /// depends on the quality of outline rendering. If the graphics system renders anti- 535 /// aliased outlines then a relatively low threshold is used, but if the graphics 536 /// system renders aliased outlines then a much higher threshold is used. 537 /// </summary> 538 alias DWRITE_OUTLINE_THRESHOLD = int; 539 enum : DWRITE_OUTLINE_THRESHOLD 540 { 541 DWRITE_OUTLINE_THRESHOLD_ANTIALIASED, 542 DWRITE_OUTLINE_THRESHOLD_ALIASED 543 } 544 545 /// <summary> 546 /// Baseline for text alignment. 547 /// </summary> 548 alias DWRITE_BASELINE = int; 549 enum : DWRITE_BASELINE 550 { 551 /// <summary> 552 /// The Roman baseline for horizontal, Central baseline for vertical. 553 /// </summary> 554 DWRITE_BASELINE_DEFAULT, 555 556 /// <summary> 557 /// The baseline used by alphabetic scripts such as Latin, Greek, Cyrillic. 558 /// </summary> 559 DWRITE_BASELINE_ROMAN, 560 561 /// <summary> 562 /// Central baseline, generally used for vertical text. 563 /// </summary> 564 DWRITE_BASELINE_CENTRAL, 565 566 /// <summary> 567 /// Mathematical baseline which math characters are centered on. 568 /// </summary> 569 DWRITE_BASELINE_MATH, 570 571 /// <summary> 572 /// Hanging baseline, used in scripts like Devanagari. 573 /// </summary> 574 DWRITE_BASELINE_HANGING, 575 576 /// <summary> 577 /// Ideographic bottom baseline for CJK, left in vertical. 578 /// </summary> 579 DWRITE_BASELINE_IDEOGRAPHIC_BOTTOM, 580 581 /// <summary> 582 /// Ideographic top baseline for CJK, right in vertical. 583 /// </summary> 584 DWRITE_BASELINE_IDEOGRAPHIC_TOP, 585 586 /// <summary> 587 /// The bottom-most extent in horizontal, left-most in vertical. 588 /// </summary> 589 DWRITE_BASELINE_MINIMUM, 590 591 /// <summary> 592 /// The top-most extent in horizontal, right-most in vertical. 593 /// </summary> 594 DWRITE_BASELINE_MAXIMUM, 595 } 596 597 /// <summary> 598 /// The desired kind of glyph orientation for the text. The client specifies 599 /// this to the analyzer as the desired orientation, but note this is the 600 /// client preference, and the constraints of the script will determine the 601 /// final presentation. 602 /// </summary> 603 alias DWRITE_VERTICAL_GLYPH_ORIENTATION = int; 604 enum : DWRITE_VERTICAL_GLYPH_ORIENTATION 605 { 606 /// <summary> 607 /// In vertical layout, naturally horizontal scripts (Latin, Thai, Arabic, 608 /// Devanagari) rotate 90 degrees clockwise, while ideographic scripts 609 /// (Chinese, Japanese, Korean) remain upright, 0 degrees. 610 /// </summary> 611 DWRITE_VERTICAL_GLYPH_ORIENTATION_DEFAULT, 612 613 /// <summary> 614 /// Ideographic scripts and scripts that permit stacking 615 /// (Latin, Hebrew) are stacked in vertical reading layout. 616 /// Connected scripts (Arabic, Syriac, 'Phags-pa, Ogham), 617 /// which would otherwise look broken if glyphs were kept 618 /// at 0 degrees, remain connected and rotate. 619 /// </summary> 620 DWRITE_VERTICAL_GLYPH_ORIENTATION_STACKED, 621 } 622 623 /// <summary> 624 /// How the glyph is oriented to the x-axis. This is an output from the text 625 /// analyzer, dependent on the desired orientation, bidi level, and character 626 /// properties. 627 /// </summary> 628 alias DWRITE_GLYPH_ORIENTATION_ANGLE = int; 629 enum : DWRITE_GLYPH_ORIENTATION_ANGLE 630 { 631 /// <summary> 632 /// Glyph orientation is upright. 633 /// </summary> 634 DWRITE_GLYPH_ORIENTATION_ANGLE_0_DEGREES, 635 636 /// <summary> 637 /// Glyph orientation is rotated 90 clockwise. 638 /// </summary> 639 DWRITE_GLYPH_ORIENTATION_ANGLE_90_DEGREES, 640 641 /// <summary> 642 /// Glyph orientation is upside-down. 643 /// </summary> 644 DWRITE_GLYPH_ORIENTATION_ANGLE_180_DEGREES, 645 646 /// <summary> 647 /// Glyph orientation is rotated 270 clockwise. 648 /// </summary> 649 DWRITE_GLYPH_ORIENTATION_ANGLE_270_DEGREES, 650 } 651 652 653 struct DWRITE_FONT_METRICS1 // : DWRITE_FONT_METRICS 654 { 655 alias dfm this; 656 DWRITE_FONT_METRICS dfm; 657 658 /// <summary> 659 /// Left edge of accumulated bounding blackbox of all glyphs in the font. 660 /// </summary> 661 INT16 glyphBoxLeft; 662 663 /// <summary> 664 /// Top edge of accumulated bounding blackbox of all glyphs in the font. 665 /// </summary> 666 INT16 glyphBoxTop; 667 668 /// <summary> 669 /// Right edge of accumulated bounding blackbox of all glyphs in the font. 670 /// </summary> 671 INT16 glyphBoxRight; 672 673 /// <summary> 674 /// Bottom edge of accumulated bounding blackbox of all glyphs in the font. 675 /// </summary> 676 INT16 glyphBoxBottom; 677 678 /// <summary> 679 /// Horizontal position of the subscript relative to the baseline origin. 680 /// This is typically negative (to the left) in italic/oblique fonts, and 681 /// zero in regular fonts. 682 /// </summary> 683 INT16 subscriptPositionX; 684 685 /// <summary> 686 /// Vertical position of the subscript relative to the baseline. 687 /// This is typically negative. 688 /// </summary> 689 INT16 subscriptPositionY; 690 691 /// <summary> 692 /// Horizontal size of the subscript em box in design units, used to 693 /// scale the simulated subscript relative to the full em box size. 694 /// This the numerator of the scaling ratio where denominator is the 695 /// design units per em. If this member is zero, the font does not specify 696 /// a scale factor, and the client should use its own policy. 697 /// </summary> 698 INT16 subscriptSizeX; 699 700 /// <summary> 701 /// Vertical size of the subscript em box in design units, used to 702 /// scale the simulated subscript relative to the full em box size. 703 /// This the numerator of the scaling ratio where denominator is the 704 /// design units per em. If this member is zero, the font does not specify 705 /// a scale factor, and the client should use its own policy. 706 /// </summary> 707 INT16 subscriptSizeY; 708 709 /// <summary> 710 /// Horizontal position of the superscript relative to the baseline origin. 711 /// This is typically positive (to the right) in italic/oblique fonts, and 712 /// zero in regular fonts. 713 /// </summary> 714 INT16 superscriptPositionX; 715 716 /// <summary> 717 /// Vertical position of the superscript relative to the baseline. 718 /// This is typically positive. 719 /// </summary> 720 INT16 superscriptPositionY; 721 722 /// <summary> 723 /// Horizontal size of the superscript em box in design units, used to 724 /// scale the simulated superscript relative to the full em box size. 725 /// This the numerator of the scaling ratio where denominator is the 726 /// design units per em. If this member is zero, the font does not specify 727 /// a scale factor, and the client should use its own policy. 728 /// </summary> 729 INT16 superscriptSizeX; 730 731 /// <summary> 732 /// Vertical size of the superscript em box in design units, used to 733 /// scale the simulated superscript relative to the full em box size. 734 /// This the numerator of the scaling ratio where denominator is the 735 /// design units per em. If this member is zero, the font does not specify 736 /// a scale factor, and the client should use its own policy. 737 /// </summary> 738 INT16 superscriptSizeY; 739 740 /// <summary> 741 /// Indicates that the ascent, descent, and lineGap are based on newer 742 /// 'typographic' values in the font, rather than legacy values. 743 /// </summary> 744 BOOL hasTypographicMetrics; 745 } 746 747 748 /// <summary> 749 /// Metrics for caret placement in a font. 750 /// </summary> 751 struct DWRITE_CARET_METRICS 752 { 753 /// <summary> 754 /// Vertical rise of the caret. Rise / Run yields the caret angle. 755 /// Rise = 1 for perfectly upright fonts (non-italic). 756 /// </summary> 757 INT16 slopeRise; 758 759 /// <summary> 760 /// Horizontal run of th caret. Rise / Run yields the caret angle. 761 /// Run = 0 for perfectly upright fonts (non-italic). 762 /// </summary> 763 INT16 slopeRun; 764 765 /// <summary> 766 /// Horizontal offset of the caret along the baseline for good appearance. 767 /// Offset = 0 for perfectly upright fonts (non-italic). 768 /// </summary> 769 INT16 offset; 770 } 771 772 773 /// <summary> 774 /// Typeface classification values, used for font selection and matching. 775 /// </summary> 776 /// <remarks> 777 /// Note the family type (index 0) is the only stable entry in the 10-byte 778 /// array, as all the following entries can change dynamically depending on 779 /// context of the first field. 780 /// </remarks> 781 union DWRITE_PANOSE 782 { 783 UINT8[10] values; 784 785 UINT8 familyKind; // this is the only field that never changes meaning 786 787 struct text_ 788 { 789 UINT8 familyKind; // = 2 for text 790 UINT8 serifStyle; 791 UINT8 weight; 792 UINT8 proportion; 793 UINT8 contrast; 794 UINT8 strokeVariation; 795 UINT8 armStyle; 796 UINT8 letterform; 797 UINT8 midline; 798 UINT8 xHeight; 799 } 800 text_ text; 801 802 struct script_ 803 { 804 UINT8 familyKind; // = 3 for script 805 UINT8 toolKind; 806 UINT8 weight; 807 UINT8 spacing; 808 UINT8 aspectRatio; 809 UINT8 contrast; 810 UINT8 scriptTopology; 811 UINT8 scriptForm; 812 UINT8 finials; 813 UINT8 xAscent; 814 } 815 script_ script; 816 817 struct decorative_ 818 { 819 UINT8 familyKind; // = 4 for decorative 820 UINT8 decorativeClass; 821 UINT8 weight; 822 UINT8 aspect; 823 UINT8 contrast; 824 UINT8 serifVariant; 825 UINT8 fill; // treatment 826 UINT8 lining; 827 UINT8 decorativeTopology; 828 UINT8 characterRange; 829 } 830 decorative_ decorative; 831 832 struct symbol_ 833 { 834 UINT8 familyKind; // = 5 for symbol 835 UINT8 symbolKind; 836 UINT8 weight; 837 UINT8 spacing; 838 UINT8 aspectRatioAndContrast; // hard coded to no-fit (1) 839 UINT8 aspectRatio94; 840 UINT8 aspectRatio119; 841 UINT8 aspectRatio157; 842 UINT8 aspectRatio163; 843 UINT8 aspectRatio211; 844 } 845 symbol_ symbol; 846 } 847 848 849 /// <summary> 850 /// Range of Unicode codepoints. 851 /// </summary> 852 struct DWRITE_UNICODE_RANGE 853 { 854 /// <summary> 855 /// The first codepoint in the Unicode range. 856 /// </summary> 857 UINT32 first; 858 859 /// <summary> 860 /// The last codepoint in the Unicode range. 861 /// </summary> 862 UINT32 last; 863 } 864 865 866 /// <summary> 867 /// Script-specific properties for caret navigation and justification. 868 /// </summary> 869 struct DWRITE_SCRIPT_PROPERTIES 870 { 871 align(1): 872 /// <summary> 873 /// The standardized four character code for the given script. 874 /// Note these only include the general Unicode scripts, not any 875 /// additional ISO 15924 scripts for bibliographic distinction 876 /// (for example, Fraktur Latin vs Gaelic Latin). 877 /// http://unicode.org/iso15924/iso15924-codes.html 878 /// </summary> 879 UINT32 isoScriptCode; 880 881 /// <summary> 882 /// The standardized numeric code, ranging 0-999. 883 /// http://unicode.org/iso15924/iso15924-codes.html 884 /// </summary> 885 UINT32 isoScriptNumber; 886 887 /// <summary> 888 /// Number of characters to estimate look-ahead for complex scripts. 889 /// Latin and all Kana are generally 1. Indic scripts are up to 15, 890 /// and most others are 8. Note that combining marks and variation 891 /// selectors can produce clusters longer than these look-aheads, 892 /// so this estimate is considered typical language use. Diacritics 893 /// must be tested explicitly separately. 894 /// </summary> 895 UINT32 clusterLookahead; 896 897 /// <summary> 898 /// Appropriate character to elongate the given script for justification. 899 /// 900 /// Examples: 901 /// Arabic - U+0640 Tatweel 902 /// Ogham - U+1680 Ogham Space Mark 903 /// </summary> 904 UINT32 justificationCharacter; 905 906 UINT32 data_; 907 //TODO: add helper properties for data members below 908 909 /* 910 /// <summary> 911 /// Restrict the caret to whole clusters, like Thai and Devanagari. Scripts 912 /// such as Arabic by default allow navigation between clusters. Others 913 /// like Thai always navigate across whole clusters. 914 /// </summary> 915 UINT32 restrictCaretToClusters : 1; 916 917 /// <summary> 918 /// The language uses dividers between words, such as spaces between Latin 919 /// or the Ethiopic wordspace. 920 /// 921 /// Examples: Latin, Greek, Devanagari, Ethiopic 922 /// Excludes: Chinese, Korean, Thai. 923 /// </summary> 924 UINT32 usesWordDividers : 1; 925 926 /// <summary> 927 /// The characters are discrete units from each other. This includes both 928 /// block scripts and clustered scripts. 929 /// 930 /// Examples: Latin, Greek, Cyrillic, Hebrew, Chinese, Thai 931 /// </summary> 932 UINT32 isDiscreteWriting : 1; 933 934 /// <summary> 935 /// The language is a block script, expanding between characters. 936 /// 937 /// Examples: Chinese, Japanese, Korean, Bopomofo. 938 /// </summary> 939 UINT32 isBlockWriting : 1; 940 941 /// <summary> 942 /// The language is justified within glyph clusters, not just between glyph 943 /// clusters. One such as the character sequence is Thai Lu and Sara Am 944 /// (U+E026, U+E033) which form a single cluster but still expand between 945 /// them. 946 /// 947 /// Examples: Thai, Lao, Khmer 948 /// </summary> 949 UINT32 isDistributedWithinCluster : 1; 950 951 /// <summary> 952 /// The script's clusters are connected to each other (such as the 953 /// baseline-linked Devanagari), and no separation should be added 954 /// between characters. Note that cursively linked scripts like Arabic 955 /// are also connected (but not all connected scripts are 956 /// cursive). 957 /// 958 /// Examples: Devanagari, Arabic, Syriac, Bengali, Gurmukhi, Ogham 959 /// Excludes: Latin, Chinese, Thaana 960 /// </summary> 961 UINT32 isConnectedWriting : 1; 962 963 /// <summary> 964 /// The script is naturally cursive (Arabic/Syriac), meaning it uses other 965 /// justification methods like kashida extension rather than intercharacter 966 /// spacing. Note that although other scripts like Latin and Japanese may 967 /// actually support handwritten cursive forms, they are not considered 968 /// cursive scripts. 969 /// 970 /// Examples: Arabic, Syriac, Mongolian 971 /// Excludes: Thaana, Devanagari, Latin, Chinese 972 /// </summary> 973 UINT32 isCursiveWriting : 1; 974 975 UINT32 reserved : 25; 976 */ 977 } 978 979 980 /// <summary> 981 /// Justification information per glyph. 982 /// </summary> 983 struct DWRITE_JUSTIFICATION_OPPORTUNITY 984 { 985 align(1): 986 /// <summary> 987 /// Minimum amount of expansion to apply to the side of the glyph. 988 /// This may vary from 0 to infinity, typically being zero except 989 /// for kashida. 990 /// </summary> 991 FLOAT expansionMinimum; 992 993 /// <summary> 994 /// Maximum amount of expansion to apply to the side of the glyph. 995 /// This may vary from 0 to infinity, being zero for fixed-size characters 996 /// and connected scripts, and non-zero for discrete scripts, and non-zero 997 /// for cursive scripts at expansion points. 998 /// </summary> 999 FLOAT expansionMaximum; 1000 1001 /// <summary> 1002 /// Maximum amount of compression to apply to the side of the glyph. 1003 /// This may vary from 0 up to the glyph cluster size. 1004 /// </summary> 1005 FLOAT compressionMaximum; 1006 1007 UINT32 data_; 1008 //TODO: add helper properties for data members below 1009 /* 1010 /// <summary> 1011 /// Priority of this expansion point. Larger priorities are applied later, 1012 /// while priority zero does nothing. 1013 /// </summary> 1014 UINT32 expansionPriority : 8; 1015 1016 /// <summary> 1017 /// Priority of this compression point. Larger priorities are applied later, 1018 /// while priority zero does nothing. 1019 /// </summary> 1020 UINT32 compressionPriority : 8; 1021 1022 /// <summary> 1023 /// Allow this expansion point to use up any remaining slack space even 1024 /// after all expansion priorities have been used up. 1025 /// </summary> 1026 UINT32 allowResidualExpansion : 1; 1027 1028 /// <summary> 1029 /// Allow this compression point to use up any remaining space even after 1030 /// all compression priorities have been used up. 1031 /// </summary> 1032 UINT32 allowResidualCompression : 1; 1033 1034 /// <summary> 1035 /// Apply expansion/compression to the leading edge of the glyph. This will 1036 /// be false for connected scripts, fixed-size characters, and diacritics. 1037 /// It is generally false within a multi-glyph cluster, unless the script 1038 /// allows expansion of glyphs within a cluster, like Thai. 1039 /// </summary> 1040 UINT32 applyToLeadingEdge : 1; 1041 1042 /// <summary> 1043 /// Apply expansion/compression to the trailing edge of the glyph. This will 1044 /// be false for connected scripts, fixed-size characters, and diacritics. 1045 /// It is generally false within a multi-glyph cluster, unless the script 1046 /// allows expansion of glyphs within a cluster, like Thai. 1047 /// </summary> 1048 UINT32 applyToTrailingEdge : 1; 1049 1050 UINT32 reserved : 12; 1051 */ 1052 } 1053 1054 1055 1056 1057 /// <summary> 1058 /// The root factory interface for all DWrite objects. 1059 /// </summary> 1060 mixin( uuid!(IDWriteFactory1, "30572f99-dac6-41db-a16e-0486307e606a") ); 1061 interface IDWriteFactory1 : IDWriteFactory 1062 { 1063 extern(Windows): 1064 /// <summary> 1065 /// Gets a font collection representing the set of end-user defined 1066 /// custom fonts. 1067 /// </summary> 1068 /// <param name="fontCollection">Receives a pointer to the EUDC font 1069 /// collection object, or NULL in case of failure.</param> 1070 /// <param name="checkForUpdates">If this parameter is nonzero, the 1071 /// function performs an immediate check for changes to the set of 1072 /// EUDC fonts. If this parameter is FALSE, the function will still 1073 /// detect changes, but there may be some latency. For example, an 1074 /// application might specify TRUE if it has itself just modified a 1075 /// font and wants to be sure the font collection contains that font. 1076 /// </param> 1077 /// <returns> 1078 /// Standard HRESULT error code. Note that if no EUDC is set on the system, 1079 /// the returned collection will be empty, meaning it will return success 1080 /// but GetFontFamilyCount will be zero. 1081 /// </returns> 1082 /// <remarks> 1083 /// Querying via IDWriteFontCollection::FindFamilyName for a specific 1084 /// family (like MS Gothic) will return the matching family-specific EUDC 1085 /// font if one exists. Querying for "" will return the global EUDC font. 1086 /// For example, if you were matching an EUDC character within a run of 1087 /// the base font PMingLiu, you would retrieve the corresponding EUDC font 1088 /// face using GetEudcFontCollection, then FindFamilyName with "PMingLiu", 1089 /// followed by GetFontFamily and CreateFontFace. 1090 /// 1091 /// Be aware that eudcedit.exe can create placeholder empty glyphs that 1092 /// have zero advance width and no glyph outline. Although they are present 1093 /// in the font (HasCharacter returns true), you are best to ignore 1094 /// these and continue on with font fallback in your layout if the metrics 1095 /// for the glyph are zero. 1096 /// </remarks> 1097 HRESULT GetEudcFontCollection( 1098 /*out*/ IDWriteFontCollection* fontCollection, 1099 BOOL checkForUpdates = FALSE 1100 ); 1101 1102 /// <summary> 1103 /// Creates a rendering parameters object with the specified properties. 1104 /// </summary> 1105 /// <param name="gamma">The gamma value used for gamma correction, which must be greater than zero and cannot exceed 256.</param> 1106 /// <param name="enhancedContrast">The amount of contrast enhancement, zero or greater.</param> 1107 /// <param name="enhancedContrastGrayscale">The amount of contrast enhancement to use for grayscale antialiasing, zero or greater.</param> 1108 /// <param name="clearTypeLevel">The degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType).</param> 1109 /// <param name="pixelGeometry">The geometry of a device pixel.</param> 1110 /// <param name="renderingMode">Method of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode.</param> 1111 /// <param name="renderingParams">Holds the newly created rendering parameters object, or NULL in case of failure.</param> 1112 /// <returns> 1113 /// Standard HRESULT error code. 1114 /// </returns> 1115 HRESULT CreateCustomRenderingParams( 1116 FLOAT gamma, 1117 FLOAT enhancedContrast, 1118 FLOAT enhancedContrastGrayscale, 1119 FLOAT clearTypeLevel, 1120 DWRITE_PIXEL_GEOMETRY pixelGeometry, 1121 DWRITE_RENDERING_MODE renderingMode, 1122 /*out*/ IDWriteRenderingParams1* renderingParams 1123 ); 1124 1125 //using IDWriteFactory::CreateCustomRenderingParams; 1126 } 1127 1128 1129 /// <summary> 1130 /// The interface that represents an absolute reference to a font face. 1131 /// It contains font face type, appropriate file references and face identification data. 1132 /// Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace. 1133 /// </summary> 1134 mixin( uuid!(IDWriteFontFace1, "a71efdb4-9fdb-4838-ad90-cfc3be8c3daf") ); 1135 interface IDWriteFontFace1 : IDWriteFontFace 1136 { 1137 extern(Windows): 1138 /// <summary> 1139 /// Gets common metrics for the font in design units. 1140 /// These metrics are applicable to all the glyphs within a font, 1141 /// and are used by applications for layout calculations. 1142 /// </summary> 1143 /// <param name="fontMetrics">Metrics structure to fill in.</param> 1144 void GetMetrics( 1145 /*out*/ DWRITE_FONT_METRICS1* fontMetrics 1146 ); 1147 1148 /// <summary> 1149 /// Gets common metrics for the font in design units. 1150 /// These metrics are applicable to all the glyphs within a font, 1151 /// and are used by applications for layout calculations. 1152 /// </summary> 1153 /// <param name="emSize">Logical size of the font in DIP units. A DIP 1154 /// ("device-independent pixel") equals 1/96 inch.</param> 1155 /// <param name="pixelsPerDip">Number of physical pixels per DIP. For 1156 /// example, if the DPI of the rendering surface is 96 this value is 1157 /// 1.0f. If the DPI is 120, this value is 120.0f/96.</param> 1158 /// <param name="transform">Optional transform applied to the glyphs and 1159 /// their positions. This transform is applied after the scaling 1160 /// specified by the font size and pixelsPerDip.</param> 1161 /// <param name="fontMetrics">Font metrics structure to fill in.</param> 1162 /// <returns> 1163 /// Standard HRESULT error code. 1164 /// </returns> 1165 HRESULT GetGdiCompatibleMetrics( 1166 FLOAT emSize, 1167 FLOAT pixelsPerDip, 1168 const(DWRITE_MATRIX)* transform, 1169 /*out*/ DWRITE_FONT_METRICS1* fontMetrics 1170 ); 1171 1172 /// <summary> 1173 /// Gets caret metrics for the font in design units. These are used by 1174 /// text editors for drawing the correct caret placement/slant. 1175 /// </summary> 1176 /// <param name="caretMetrics">Metrics structure to fill in.</param> 1177 void GetCaretMetrics( 1178 /*out*/ DWRITE_CARET_METRICS* caretMetrics 1179 ); 1180 1181 /// <summary> 1182 /// Returns the list of character ranges supported by the font, which is 1183 /// useful for scenarios like character picking, glyph display, and 1184 /// efficient font selection lookup. This is similar to GDI's 1185 /// GetFontUnicodeRanges, except that it returns the full Unicode range, 1186 /// not just 16-bit UCS-2. 1187 /// </summary> 1188 /// <param name="maxRangeCount">Maximum number of character ranges passed 1189 /// in from the client.</param> 1190 /// <param name="unicodeRanges">Array of character ranges.</param> 1191 /// <param name="actualRangeCount">Actual number of character ranges, 1192 /// regardless of the maximum count.</param> 1193 /// <remarks> 1194 /// These ranges are from the cmap, not the OS/2::ulCodePageRange1. 1195 /// </remarks> 1196 /// <returns> 1197 /// Standard HRESULT error code. 1198 /// </returns> 1199 HRESULT GetUnicodeRanges( 1200 UINT32 maxRangeCount, 1201 /*out*/ DWRITE_UNICODE_RANGE* unicodeRanges, 1202 /*out*/ UINT32* actualRangeCount 1203 ); 1204 1205 /// <summary> 1206 /// Returns true if the font is monospaced, meaning its characters are the 1207 /// same fixed-pitch width (non-proportional). 1208 /// </summary> 1209 BOOL IsMonospacedFont(); 1210 1211 /// <summary> 1212 /// Returns the advances in design units for a sequences of glyphs. 1213 /// </summary> 1214 /// <param name="glyphCount">Number of glyphs to retrieve advances for.</param> 1215 /// <param name="glyphIndices">Array of glyph id's to retrieve advances for.</param> 1216 /// <param name="glyphAdvances">Returned advances in font design units for 1217 /// each glyph.</param> 1218 /// <param name="isSideways">Retrieve the glyph's vertical advance height 1219 /// rather than horizontal advance widths.</param> 1220 /// <remarks> 1221 /// This is equivalent to calling GetGlyphMetrics and using only the 1222 /// advance width/height. 1223 /// </remarks> 1224 /// <returns> 1225 /// Standard HRESULT error code. 1226 /// </returns> 1227 HRESULT GetDesignGlyphAdvances( 1228 UINT32 glyphCount, 1229 const(UINT16)* glyphIndices, 1230 /*out*/ INT32* glyphAdvances, 1231 BOOL isSideways = FALSE 1232 ); 1233 1234 /// <summary> 1235 /// Returns the pixel-aligned advances for a sequences of glyphs, the same 1236 /// as GetGdiCompatibleGlyphMetrics would return. 1237 /// </summary> 1238 /// <param name="emSize">Logical size of the font in DIP units. A DIP 1239 /// ("device-independent pixel") equals 1/96 inch.</param> 1240 /// <param name="pixelsPerDip">Number of physical pixels per DIP. For 1241 /// example, if the DPI of the rendering surface is 96 this value is 1242 /// 1.0f. If the DPI is 120, this value is 120.0f/96.</param> 1243 /// <param name="transform">Optional transform applied to the glyphs and 1244 /// their positions. This transform is applied after the scaling 1245 /// specified by the font size and pixelsPerDip.</param> 1246 /// <param name="useGdiNatural">When FALSE, the metrics are the same as 1247 /// GDI aliased text (DWRITE_MEASURING_MODE_GDI_CLASSIC). When TRUE, 1248 /// the metrics are the same as those measured by GDI using a font 1249 /// using CLEARTYPE_NATURAL_QUALITY (DWRITE_MEASURING_MODE_GDI_NATURAL).</param> 1250 /// <param name="isSideways">Retrieve the glyph's vertical advances rather 1251 /// than horizontal advances.</param> 1252 /// <param name="glyphCount">Total glyphs to retrieve adjustments for.</param> 1253 /// <param name="glyphIndices">Array of glyph id's to retrieve advances.</param> 1254 /// <param name="glyphAdvances">Returned advances in font design units for 1255 /// each glyph.</param> 1256 /// <remarks> 1257 /// This is equivalent to calling GetGdiCompatibleGlyphMetrics and using only 1258 /// the advance width/height. Like GetGdiCompatibleGlyphMetrics, these are in 1259 /// design units, meaning they must be scaled down by 1260 /// DWRITE_FONT_METRICS::designUnitsPerEm. 1261 /// </remarks> 1262 /// <returns> 1263 /// Standard HRESULT error code. 1264 /// </returns> 1265 HRESULT GetGdiCompatibleGlyphAdvances( 1266 FLOAT emSize, 1267 FLOAT pixelsPerDip, 1268 const(DWRITE_MATRIX)* transform, 1269 BOOL useGdiNatural, 1270 BOOL isSideways, 1271 UINT32 glyphCount, 1272 const(UINT16)* glyphIndices, 1273 /*out*/ INT32* glyphAdvances 1274 ); 1275 1276 /// <summary> 1277 /// Retrieves the kerning pair adjustments from the font's kern table. 1278 /// </summary> 1279 /// <param name="glyphCount">Number of glyphs to retrieve adjustments for.</param> 1280 /// <param name="glyphIndices">Array of glyph id's to retrieve adjustments 1281 /// for.</param> 1282 /// <param name="glyphAdvanceAdjustments">Returned advances in font design units for 1283 /// each glyph. The last glyph adjustment is zero.</param> 1284 /// <remarks> 1285 /// This is not a direct replacement for GDI's character based 1286 /// GetKerningPairs, but it serves the same role, without the client 1287 /// needing to cache them locally. It also uses glyph id's directly 1288 /// rather than UCS-2 characters (how the kern table actually stores 1289 /// them) which avoids glyph collapse and ambiguity, such as the dash 1290 /// and hyphen, or space and non-breaking space. 1291 /// </remarks> 1292 /// <remarks> 1293 /// Newer fonts may have only GPOS kerning instead of the legacy pair 1294 /// table kerning. Such fonts, like Gabriola, will only return 0's for 1295 /// adjustments. This function does not virtualize and flatten these 1296 /// GPOS entries into kerning pairs. 1297 /// </remarks> 1298 /// <returns> 1299 /// Standard HRESULT error code. 1300 /// </returns> 1301 HRESULT GetKerningPairAdjustments( 1302 UINT32 glyphCount, 1303 const(UINT16)* glyphIndices, 1304 /*out*/ INT32* glyphAdvanceAdjustments 1305 ); 1306 1307 /// <summary> 1308 /// Returns whether or not the font supports pair-kerning. 1309 /// </summary> 1310 /// <remarks> 1311 /// If the font does not support pair table kerning, there is no need to 1312 /// call GetKerningPairAdjustments (it would be all zeroes). 1313 /// </remarks> 1314 /// <returns> 1315 /// Whether the font supports kerning pairs. 1316 /// </returns> 1317 BOOL HasKerningPairs(); 1318 1319 /// <summary> 1320 /// Determines the recommended text rendering mode to be used based on the 1321 /// font, size, world transform, and measuring mode. 1322 /// </summary> 1323 /// <param name="fontEmSize">Logical font size in DIPs.</param> 1324 /// <param name="dpiX">Number of pixels per logical inch in the horizontal direction.</param> 1325 /// <param name="dpiY">Number of pixels per logical inch in the vertical direction.</param> 1326 /// <param name="transform">Specifies the world transform.</param> 1327 /// <param name="outlineThreshold">Specifies the quality of the graphics system's outline rendering, 1328 /// affects the size threshold above which outline rendering is used.</param> 1329 /// <param name="measuringMode">Specifies the method used to measure during text layout. For proper 1330 /// glyph spacing, the function returns a rendering mode that is compatible with the specified 1331 /// measuring mode.</param> 1332 /// <param name="renderingMode">Receives the recommended rendering mode.</param> 1333 /// <remarks> 1334 /// This method should be used to determine the actual rendering mode in cases where the rendering 1335 /// mode of the rendering params object is DWRITE_RENDERING_MODE_DEFAULT. 1336 /// </remarks> 1337 /// <returns> 1338 /// Standard HRESULT error code. 1339 /// </returns> 1340 HRESULT GetRecommendedRenderingMode( 1341 FLOAT fontEmSize, 1342 FLOAT dpiX, 1343 FLOAT dpiY, 1344 const(DWRITE_MATRIX)* transform, 1345 BOOL isSideways, 1346 DWRITE_OUTLINE_THRESHOLD outlineThreshold, 1347 DWRITE_MEASURING_MODE measuringMode, 1348 /*out*/ DWRITE_RENDERING_MODE* renderingMode 1349 ); 1350 1351 /// <summary> 1352 /// Retrieves the vertical forms of the nominal glyphs retrieved from 1353 /// GetGlyphIndices, using the font's 'vert' table. This is used in 1354 /// CJK vertical layout so the correct characters are shown. 1355 /// </summary> 1356 /// <param name="glyphCount">Number of glyphs to retrieve.</param> 1357 /// <param name="nominalGlyphIndices">Original glyph indices from cmap.</param> 1358 /// <param name="verticalGlyphIndices">The vertical form of glyph indices.</param> 1359 /// <remarks> 1360 /// Call GetGlyphIndices to get the nominal glyph indices, followed by 1361 /// calling this to remap the to the substituted forms, when the run 1362 /// is sideways, and the font has vertical glyph variants. 1363 /// </remarks> 1364 /// <returns> 1365 /// Standard HRESULT error code. 1366 /// </returns> 1367 HRESULT GetVerticalGlyphVariants( 1368 UINT32 glyphCount, 1369 const(UINT16)* nominalGlyphIndices, 1370 /*out*/ UINT16* verticalGlyphIndices 1371 ); 1372 1373 /// <summary> 1374 /// Returns whether or not the font has any vertical glyph variants. 1375 /// </summary> 1376 /// <remarks> 1377 /// For OpenType fonts, this will return true if the font contains a 'vert' 1378 /// feature. 1379 /// </remarks> 1380 /// <returns> 1381 /// True if the font contains vertical glyph variants. 1382 /// </returns> 1383 BOOL HasVerticalGlyphVariants(); 1384 } 1385 1386 1387 /// <summary> 1388 /// The IDWriteFont interface represents a physical font in a font collection. 1389 /// </summary> 1390 mixin( uuid!(IDWriteFont1, "acd16696-8c14-4f5d-877e-fe3fc1d32738") ); 1391 interface IDWriteFont1 : IDWriteFont 1392 { 1393 extern(Windows): 1394 /// <summary> 1395 /// Gets common metrics for the font in design units. 1396 /// These metrics are applicable to all the glyphs within a font, 1397 /// and are used by applications for layout calculations. 1398 /// </summary> 1399 /// <param name="fontMetrics">Metrics structure to fill in.</param> 1400 void GetMetrics( 1401 /*out*/ DWRITE_FONT_METRICS1* fontMetrics 1402 ); 1403 1404 /// <summary> 1405 /// Gets the PANOSE values from the font, used for font selection and 1406 /// matching. 1407 /// </summary> 1408 /// <param name="panose">PANOSE structure to fill in.</param> 1409 /// <remarks> 1410 /// The function does not simulate these, such as substituting a weight or 1411 /// proportion inferred on other values. If the font does not specify them, 1412 /// they are all set to 'any' (0). 1413 /// </remarks> 1414 void GetPanose( 1415 /*out*/ DWRITE_PANOSE* panose 1416 ); 1417 1418 /// <summary> 1419 /// Returns the list of character ranges supported by the font, which is 1420 /// useful for scenarios like character picking, glyph display, and 1421 /// efficient font selection lookup. This is similar to GDI's 1422 /// GetFontUnicodeRanges, except that it returns the full Unicode range, 1423 /// not just 16-bit UCS-2. 1424 /// </summary> 1425 /// <param name="maxRangeCount">Maximum number of character ranges passed 1426 /// in from the client.</param> 1427 /// <param name="unicodeRanges">Array of character ranges.</param> 1428 /// <param name="actualRangeCount">Actual number of character ranges, 1429 /// regardless of the maximum count.</param> 1430 /// <remarks> 1431 /// These ranges are from the cmap, not the OS/2::ulCodePageRange1. 1432 /// </remarks> 1433 /// <returns> 1434 /// Standard HRESULT error code. 1435 /// </returns> 1436 HRESULT GetUnicodeRanges( 1437 UINT32 maxRangeCount, 1438 /*out*/ DWRITE_UNICODE_RANGE* unicodeRanges, 1439 /*out*/ UINT32* actualRangeCount 1440 ); 1441 1442 /// <summary> 1443 /// Returns true if the font is monospaced, meaning its characters are the 1444 /// same fixed-pitch width (non-proportional). 1445 /// </summary> 1446 BOOL IsMonospacedFont(); 1447 } 1448 1449 /// <summary> 1450 /// The interface that represents text rendering settings for glyph rasterization and filtering. 1451 /// </summary> 1452 mixin( uuid!(IDWriteRenderingParams1, "94413cf4-a6fc-4248-8b50-6674348fcad3") ); 1453 interface IDWriteRenderingParams1 : IDWriteRenderingParams 1454 { 1455 extern(Windows): 1456 /// <summary> 1457 /// Gets the amount of contrast enhancement to use for grayscale antialiasing. 1458 /// Valid values are greater than or equal to zero. 1459 /// </summary> 1460 FLOAT GetGrayscaleEnhancedContrast(); 1461 } 1462 1463 /// <summary> 1464 /// Analyzes various text properties for complex script processing. 1465 /// </summary> 1466 mixin( uuid!(IDWriteTextAnalyzer1, "80DAD800-E21F-4E83-96CE-BFCCE500DB7C") ); 1467 interface IDWriteTextAnalyzer1 : IDWriteTextAnalyzer 1468 { 1469 extern(Windows): 1470 /// <summary> 1471 /// Applies spacing between characters, properly adjusting glyph clusters 1472 /// and diacritics. 1473 /// </summary> 1474 /// <param name="leadingSpacing">The spacing before each character, in reading order.</param> 1475 /// <param name="trailingSpacing">The spacing after each character, in reading order.</param> 1476 /// <param name="minimumAdvanceWidth">The minimum advance of each character, 1477 /// to prevent characters from becoming too thin or zero-width. This 1478 /// must be zero or greater.</param> 1479 /// <param name="textLength">The length of the clustermap and original text.</param> 1480 /// <param name="glyphCount">The number of glyphs.</param> 1481 /// <param name="clusterMap">Mapping from character ranges to glyph ranges.</param> 1482 /// <param name="glyphAdvances">The advance width of each glyph.</param> 1483 /// <param name="glyphOffsets">The offset of the origin of each glyph.</param> 1484 /// <param name="glyphProperties">Properties of each glyph, from GetGlyphs.</param> 1485 /// <param name="modifiedGlyphAdvances">The new advance width of each glyph.</param> 1486 /// <param name="modifiedGlyphOffsets">The new offset of the origin of each glyph.</param> 1487 /// <remarks> 1488 /// The input and output advances/offsets are allowed to alias the same array. 1489 /// </remarks> 1490 /// <returns> 1491 /// Standard HRESULT error code. 1492 /// </returns> 1493 HRESULT ApplyCharacterSpacing( 1494 FLOAT leadingSpacing, 1495 FLOAT trailingSpacing, 1496 FLOAT minimumAdvanceWidth, 1497 UINT32 textLength, 1498 UINT32 glyphCount, 1499 const(UINT16)* clusterMap, 1500 const(FLOAT)* glyphAdvances, 1501 const(DWRITE_GLYPH_OFFSET)* glyphOffsets, 1502 const(DWRITE_SHAPING_GLYPH_PROPERTIES)* glyphProperties, 1503 /*out*/ FLOAT* modifiedGlyphAdvances, 1504 /*out*/ DWRITE_GLYPH_OFFSET* modifiedGlyphOffsets 1505 ); 1506 1507 /// <summary> 1508 /// Retrieves the given baseline from the font. 1509 /// </summary> 1510 /// <param name="fontFace">The font face to read.</param> 1511 /// <param name="baseline">The baseline of interest.</param> 1512 /// <param name="isVertical">Whether the baseline is vertical or horizontal.</param> 1513 /// <param name="isSimulationAllowed">Simulate the baseline if it is missing in the font.</param> 1514 /// <param name="scriptAnalysis">Script analysis result from AnalyzeScript.</param> 1515 /// <param name="localeName">The language of the run.</param> 1516 /// <param name="baselineCoordinate">The baseline coordinate value in design units.</param> 1517 /// <param name="exists">Whether the returned baseline exists in the font.</param> 1518 /// <remarks> 1519 /// If the baseline does not exist in the font, it is not considered an 1520 /// error, but the function will return exists = false. You may then use 1521 /// heuristics to calculate the missing base, or, if the flag 1522 /// simulationAllowed is true, the function will compute a reasonable 1523 /// approximation for you. 1524 /// </remarks> 1525 /// <returns> 1526 /// Standard HRESULT error code. 1527 /// </returns> 1528 HRESULT GetBaseline( 1529 IDWriteFontFace fontFace, 1530 DWRITE_BASELINE baseline, 1531 BOOL isVertical, 1532 BOOL isSimulationAllowed, 1533 DWRITE_SCRIPT_ANALYSIS scriptAnalysis, 1534 const(WCHAR)* localeName, 1535 /*out*/ INT32* baselineCoordinate, 1536 /*out*/ BOOL* exists 1537 ); 1538 1539 /// <summary> 1540 /// Analyzes a text range for script orientation, reading text and 1541 /// attributes from the source and reporting results to the sink. 1542 /// </summary> 1543 /// <param name="analysisSource">Source object to analyze.</param> 1544 /// <param name="textPosition">Starting position within the source object.</param> 1545 /// <param name="textLength">Length to analyze.</param> 1546 /// <param name="analysisSink">Callback object.</param> 1547 /// <returns> 1548 /// Standard HRESULT error code. 1549 /// </returns> 1550 /// <remarks> 1551 /// All bidi analysis should be resolved before calling this. 1552 /// </remarks> 1553 HRESULT AnalyzeVerticalGlyphOrientation( 1554 IDWriteTextAnalysisSource1 analysisSource, 1555 UINT32 textPosition, 1556 UINT32 textLength, 1557 IDWriteTextAnalysisSink1 analysisSink 1558 ); 1559 1560 /// <summary> 1561 /// Returns 2x3 transform matrix for the respective angle to draw the 1562 /// glyph run. 1563 /// </summary> 1564 /// <param name="glyphOrientationAngle">The angle reported into 1565 /// SetGlyphOrientation.</param> 1566 /// <param name="isSideways">Whether the run's glyphs are sideways or not.</param> 1567 /// <param name="transform">Returned transform.</param> 1568 /// </remarks> 1569 /// <returns> 1570 /// Standard HRESULT error code. 1571 /// </returns> 1572 /// <remarks> 1573 /// The returned displacement is zero. 1574 /// </remarks> 1575 HRESULT GetGlyphOrientationTransform( 1576 DWRITE_GLYPH_ORIENTATION_ANGLE glyphOrientationAngle, 1577 BOOL isSideways, 1578 /*out*/ DWRITE_MATRIX* transform 1579 ); 1580 1581 /// <summary> 1582 /// Returns the properties for a given script. 1583 /// </summary> 1584 /// <param name="scriptAnalysis">The script for a run of text returned 1585 /// from IDWriteTextAnalyzer::AnalyzeScript.</param> 1586 /// <param name="scriptProperties">Information for the script.</param> 1587 /// <returns> 1588 /// Returns properties for the given script. If the script is invalid, 1589 /// it returns generic properties for the unknown script and E_INVALIDARG. 1590 /// </returns> 1591 HRESULT GetScriptProperties( 1592 DWRITE_SCRIPT_ANALYSIS scriptAnalysis, 1593 /*out*/ DWRITE_SCRIPT_PROPERTIES* scriptProperties 1594 ); 1595 1596 /// <summary> 1597 /// Determines the complexity of text, and whether or not full script 1598 /// shaping needs to be called (GetGlyphs). 1599 /// </summary> 1600 /// <param name="fontFace">The font face to read.</param> 1601 /// <param name="textLength">Length of the text to check.</param> 1602 /// <param name="textString">The text to check for complexity. This string 1603 /// may be UTF-16, but any supplementary characters will be considered 1604 /// complex.</param> 1605 /// <param name="isTextSimple">If true, the text is simple, and the 1606 /// glyphIndices array will already have the nominal glyphs for you. 1607 /// Otherwise you need to call GetGlyphs to properly shape complex 1608 /// scripts and OpenType features. 1609 /// </param> 1610 /// <param name="textLengthRead">The length read of the text run with the 1611 /// same complexity, simple or complex. You may call again from that 1612 /// point onward.</param> 1613 /// <param name="glyphIndices">Optional glyph indices for the text. If the 1614 /// function returned that the text was simple, you already have the 1615 /// glyphs you need. Otherwise the glyph indices are not meaningful, 1616 /// and you should call shaping instead.</param> 1617 /// <remarks> 1618 /// Text is not simple if the characters are part of a script that has 1619 /// complex shaping requirements, require bidi analysis, combine with 1620 /// other characters, reside in the supplementary planes, or have glyphs 1621 /// which participate in standard OpenType features. The length returned 1622 /// will not split combining marks from their base characters. 1623 /// </remarks> 1624 /// <returns> 1625 /// Standard HRESULT error code. 1626 /// </returns> 1627 HRESULT GetTextComplexity( 1628 const(WCHAR)* textString, 1629 UINT32 textLength, 1630 IDWriteFontFace fontFace, 1631 /*out*/ BOOL* isTextSimple, 1632 /*out*/ UINT32* textLengthRead, 1633 /*out*/ UINT16* glyphIndices 1634 ); 1635 1636 /// <summary> 1637 /// Retrieves justification opportunity information for each of the glyphs 1638 /// given the text and shaping glyph properties. 1639 /// </summary> 1640 /// <param name="fontFace">Font face that was used for shaping. This is 1641 /// mainly important for returning correct results of the kashida 1642 /// width.</param> 1643 /// <param name="fontEmSize">Font em size used for the glyph run.</param> 1644 /// <param name="scriptAnalysis">Script of the text from the itemizer.</param> 1645 /// <param name="textLength">Length of the text.</param> 1646 /// <param name="glyphCount">Number of glyphs.</param> 1647 /// <param name="textString">Characters used to produce the glyphs.</param> 1648 /// <param name="clusterMap">Clustermap produced from shaping.</param> 1649 /// <param name="glyphProperties">Glyph properties produced from shaping.</param> 1650 /// <param name="justificationOpportunities">Receives information for the 1651 /// allowed justification expansion/compression for each glyph.</param> 1652 /// <remarks> 1653 /// This function is called per-run, after shaping is done via GetGlyphs(). 1654 /// Note this function only supports natural metrics (DWRITE_MEASURING_MODE_NATURAL). 1655 /// </remarks> 1656 /// <returns> 1657 /// Standard HRESULT error code. 1658 /// </returns> 1659 HRESULT GetJustificationOpportunities( 1660 IDWriteFontFace fontFace, 1661 FLOAT fontEmSize, 1662 DWRITE_SCRIPT_ANALYSIS scriptAnalysis, 1663 UINT32 textLength, 1664 UINT32 glyphCount, 1665 const(WCHAR)* textString, 1666 const(UINT16)* clusterMap, 1667 const(DWRITE_SHAPING_GLYPH_PROPERTIES)* glyphProperties, 1668 /*out*/ DWRITE_JUSTIFICATION_OPPORTUNITY* justificationOpportunities 1669 ); 1670 1671 /// <summary> 1672 /// Justifies an array of glyph advances to fit the line width. 1673 /// </summary> 1674 /// <param name="lineWidth">Width of the line.</param> 1675 /// <param name="glyphCount">Number of glyphs.</param> 1676 /// <param name="justificationOpportunities">Opportunities per glyph. Call 1677 /// GetJustificationOpportunities() to get suitable opportunities 1678 /// according to script.</param> 1679 /// <param name="glyphAdvances">Original glyph advances from shaping.</param> 1680 /// <param name="glyphOffsets">Original glyph offsets from shaping.</param> 1681 /// <param name="justifiedGlyphAdvances">Justified glyph advances.</param> 1682 /// <param name="justifiedGlyphOffsets">Justified glyph offsets.</param> 1683 /// <remarks> 1684 /// This is called after all the opportunities have been collected, and it 1685 /// spans across the entire line. The input and output arrays are allowed 1686 /// to alias each other, permitting in-place update. 1687 /// </remarks> 1688 /// <returns> 1689 /// Standard HRESULT error code. 1690 /// </returns> 1691 HRESULT JustifyGlyphAdvances( 1692 FLOAT lineWidth, 1693 UINT32 glyphCount, 1694 const(DWRITE_JUSTIFICATION_OPPORTUNITY)* justificationOpportunities, 1695 const(FLOAT)* glyphAdvances, 1696 const(DWRITE_GLYPH_OFFSET)* glyphOffsets, 1697 /*out*/ FLOAT* justifiedGlyphAdvances, 1698 /*out*/ DWRITE_GLYPH_OFFSET* justifiedGlyphOffsets 1699 ); 1700 1701 /// <summary> 1702 /// Fills in new glyphs for complex scripts where justification increased 1703 /// the advances of glyphs, such as Arabic with kashida. 1704 /// </summary> 1705 /// <param name="fontFace">Font face used for shaping.</param> 1706 /// <param name="fontEmSize">Font em size used for the glyph run.</param> 1707 /// <param name="scriptAnalysis">Script of the text from the itemizer.</param> 1708 /// <param name="textLength">Length of the text.</param> 1709 /// <param name="glyphCount">Number of glyphs.</param> 1710 /// <param name="maxGlyphCount">Maximum number of output glyphs allocated 1711 /// by caller.</param> 1712 /// <param name="clusterMap">Clustermap produced from shaping.</param> 1713 /// <param name="glyphIndices">Original glyphs produced from shaping.</param> 1714 /// <param name="glyphAdvances">Original glyph advances produced from shaping.</param> 1715 /// <param name="justifiedGlyphAdvances">Justified glyph advances from 1716 /// JustifyGlyphAdvances().</param> 1717 /// <param name="justifiedGlyphOffsets">Justified glyph offsets from 1718 /// JustifyGlyphAdvances().</param> 1719 /// <param name="glyphProperties">Properties of each glyph, from GetGlyphs.</param> 1720 /// <param name="actualGlyphCount">The new glyph count written to the 1721 /// modified arrays, or the needed glyph count if the size is not 1722 /// large enough.</param> 1723 /// <param name="modifiedClusterMap">Updated clustermap.</param> 1724 /// <param name="modifiedGlyphIndices">Updated glyphs with new glyphs 1725 /// inserted where needed.</param> 1726 /// <param name="modifiedGlyphAdvances">Updated glyph advances.</param> 1727 /// <param name="modifiedGlyphOffsets">Updated glyph offsets.</param> 1728 /// <remarks> 1729 /// This is called after the line has been justified, and it is per-run. 1730 /// It only needs to be called if the script has a specific justification 1731 /// character via GetScriptProperties, and it is mainly for cursive scripts 1732 /// like Arabic. If maxGlyphCount is not large enough, the error 1733 /// E_NOT_SUFFICIENT_BUFFER will be returned, with actualGlyphCount holding 1734 /// the final/needed glyph count. 1735 /// </remarks> 1736 /// <returns> 1737 /// Standard HRESULT error code. 1738 /// </returns> 1739 HRESULT GetJustifiedGlyphs( 1740 IDWriteFontFace fontFace, 1741 FLOAT fontEmSize, 1742 DWRITE_SCRIPT_ANALYSIS scriptAnalysis, 1743 UINT32 textLength, 1744 UINT32 glyphCount, 1745 UINT32 maxGlyphCount, 1746 const(UINT16)* clusterMap, 1747 const(UINT16)* glyphIndices, 1748 const(FLOAT)* glyphAdvances, 1749 const(FLOAT)* justifiedGlyphAdvances, 1750 const(DWRITE_GLYPH_OFFSET)* justifiedGlyphOffsets, 1751 const(DWRITE_SHAPING_GLYPH_PROPERTIES)* glyphProperties, 1752 /*out*/ UINT32* actualGlyphCount, 1753 /*out*/ UINT16* modifiedClusterMap, 1754 /*out*/ UINT16* modifiedGlyphIndices, 1755 /*out*/ FLOAT* modifiedGlyphAdvances, 1756 /*out*/ DWRITE_GLYPH_OFFSET* modifiedGlyphOffsets 1757 ); 1758 } 1759 1760 1761 /// <summary> 1762 /// The interface implemented by the client to provide needed information to 1763 /// the text analyzer, such as the text and associated text properties. 1764 /// If any of these callbacks returns an error, the analysis functions will 1765 /// stop prematurely and return a callback error. 1766 /// </summary> 1767 mixin( uuid!(IDWriteTextAnalysisSource1, "639CFAD8-0FB4-4B21-A58A-067920120009") ); 1768 interface IDWriteTextAnalysisSource1 : IDWriteTextAnalysisSource 1769 { 1770 extern(Windows): 1771 /// <summary> 1772 /// The text analyzer calls back to this to get the desired glyph 1773 /// orientation and resolved bidi level, which it uses along with the 1774 /// script properties of the text to determine the actual orientation of 1775 /// each character, which it reports back to the client via the sink 1776 /// SetGlyphOrientation method. 1777 /// </summary> 1778 /// <param name="textPosition">First position of the piece to obtain. All 1779 /// positions are in UTF-16 code-units, not whole characters, which 1780 /// matters when supplementary characters are used.</param> 1781 /// <param name="textLength">Number of UTF-16 units of the retrieved chunk. 1782 /// The returned length is not the length of the block, but the length 1783 /// remaining in the block, from the given position until its end. 1784 /// So querying for a position that is 75 positions into a 100 1785 /// postition block would return 25.</param> 1786 /// <param name="glyphOrientation">The type of glyph orientation the 1787 /// client wants for this range, up to the returned text length.</param> 1788 /// <param name="bidiLevel">The bidi level for this range up to 1789 /// the returned text length, which comes from an earlier 1790 /// bidirectional analysis.</param> 1791 /// <returns> 1792 /// Standard HRESULT error code. Returning an error will abort the 1793 /// analysis. 1794 /// </returns> 1795 HRESULT GetVerticalGlyphOrientation( 1796 UINT32 textPosition, 1797 /*out*/ UINT32* textLength, 1798 /*out*/ DWRITE_VERTICAL_GLYPH_ORIENTATION* glyphOrientation, 1799 /*out*/ UINT8* bidiLevel 1800 ); 1801 } 1802 1803 1804 /// <summary> 1805 /// The interface implemented by the client to receive the 1806 /// output of the text analyzers. 1807 /// </summary> 1808 mixin( uuid!(IDWriteTextAnalysisSink1, "B0D941A0-85E7-4D8B-9FD3-5CED9934482A") ); 1809 interface IDWriteTextAnalysisSink1 : IDWriteTextAnalysisSink 1810 { 1811 extern(Windows): 1812 /// <summary> 1813 /// The text analyzer calls back to this to report the actual orientation 1814 /// of each character for shaping and drawing. 1815 /// </summary> 1816 /// <param name="textPosition">Starting position to report from.</param> 1817 /// <param name="textLength">Number of UTF-16 units of the reported range.</param> 1818 /// <param name="glyphOrientationAngle">Angle of the glyphs within the text 1819 /// range (pass to GetGlyphOrientationTransform to get the world 1820 /// relative transform).</param> 1821 /// <param name="adjustedBidiLevel">The adjusted bidi level to be used by 1822 /// the client layout for reordering runs. This will differ from the 1823 /// resolved bidi level retrieved from the source for cases such as 1824 /// Arabic stacked top-to-bottom, where the glyphs are still shaped 1825 /// as RTL, but the runs are TTB along with any CJK or Latin.</param> 1826 /// <param name="isSideways">Whether the glyphs are rotated on their side, 1827 /// which is the default case for CJK and the case stacked Latin</param> 1828 /// <param name="isRightToLeft">Whether the script should be shaped as 1829 /// right-to-left. For Arabic stacked top-to-bottom, even when the 1830 /// adjusted bidi level is coerced to an even level, this will still 1831 /// be true.</param> 1832 /// <returns> 1833 /// A successful code or error code to abort analysis. 1834 /// </returns> 1835 HRESULT SetGlyphOrientation( 1836 UINT32 textPosition, 1837 UINT32 textLength, 1838 DWRITE_GLYPH_ORIENTATION_ANGLE glyphOrientationAngle, 1839 UINT8 adjustedBidiLevel, 1840 BOOL isSideways, 1841 BOOL isRightToLeft 1842 ); 1843 } 1844 1845 1846 /// <summary> 1847 /// The IDWriteTextLayout1 interface represents a block of text after it has 1848 /// been fully analyzed and formatted. 1849 /// 1850 /// All coordinates are in device independent pixels (DIPs). 1851 /// </summary> 1852 mixin( uuid!(IDWriteTextLayout1, "9064D822-80A7-465C-A986-DF65F78B8FEB") ); 1853 interface IDWriteTextLayout1 : IDWriteTextLayout 1854 { 1855 extern(Windows): 1856 /// <summary> 1857 /// Enables/disables pair-kerning on the given range. 1858 /// </summary> 1859 /// <param name="isPairKerningEnabled">The Boolean flag indicates whether text is pair-kerned.</param> 1860 /// <param name="textRange">Text range to which this change applies.</param> 1861 /// <returns> 1862 /// Standard HRESULT error code. 1863 /// </returns> 1864 HRESULT SetPairKerning( 1865 BOOL isPairKerningEnabled, 1866 DWRITE_TEXT_RANGE textRange 1867 ); 1868 1869 /// <summary> 1870 /// Get whether or not pair-kerning is enabled at given position. 1871 /// </summary> 1872 /// <param name="currentPosition">The current text position.</param> 1873 /// <param name="isPairKerningEnabled">The Boolean flag indicates whether text is pair-kerned.</param> 1874 /// <param name="textRange">The position range of the current format.</param> 1875 /// <returns> 1876 /// Standard HRESULT error code. 1877 /// </returns> 1878 HRESULT GetPairKerning( 1879 UINT32 currentPosition, 1880 /*out*/ BOOL* isPairKerningEnabled, 1881 /*out*/ DWRITE_TEXT_RANGE* textRange = null 1882 ); 1883 1884 /// <summary> 1885 /// Sets the spacing between characters. 1886 /// </summary> 1887 /// <param name="leadingSpacing">The spacing before each character, in reading order.</param> 1888 /// <param name="trailingSpacing">The spacing after each character, in reading order.</param> 1889 /// <param name="minimumAdvanceWidth">The minimum advance of each character, 1890 /// to prevent characters from becoming too thin or zero-width. This 1891 /// must be zero or greater.</param> 1892 /// <param name="textRange">Text range to which this change applies.</param> 1893 /// <returns> 1894 /// Standard HRESULT error code. 1895 /// </returns> 1896 HRESULT SetCharacterSpacing( 1897 FLOAT leadingSpacing, 1898 FLOAT trailingSpacing, 1899 FLOAT minimumAdvanceWidth, 1900 DWRITE_TEXT_RANGE textRange 1901 ); 1902 1903 /// <summary> 1904 /// Gets the spacing between characters. 1905 /// </summary> 1906 /// <param name="currentPosition">The current text position.</param> 1907 /// <param name="leadingSpacing">The spacing before each character, in reading order.</param> 1908 /// <param name="trailingSpacing">The spacing after each character, in reading order.</param> 1909 /// <param name="minimumAdvanceWidth">The minimum advance of each character, 1910 /// to prevent characters from becoming too thin or zero-width. This 1911 /// must be zero or greater.</param> 1912 /// <param name="textRange">The position range of the current format.</param> 1913 /// <returns> 1914 /// Standard HRESULT error code. 1915 /// </returns> 1916 HRESULT GetCharacterSpacing( 1917 UINT32 currentPosition, 1918 /*out*/ FLOAT* leadingSpacing, 1919 /*out*/ FLOAT* trailingSpacing, 1920 /*out*/ FLOAT* minimumAdvanceWidth, 1921 /*out*/ DWRITE_TEXT_RANGE* textRange = null 1922 ); 1923 } 1924 1925 /// <summary> 1926 /// Represents the type of antialiasing to use for text when the rendering mode calls for 1927 /// antialiasing. 1928 /// </summary> 1929 alias DWRITE_TEXT_ANTIALIAS_MODE = int; 1930 enum : DWRITE_TEXT_ANTIALIAS_MODE 1931 { 1932 /// <summary> 1933 /// ClearType antialiasing computes coverage independently for the red, green, and blue 1934 /// color elements of each pixel. This allows for more detail than conventional antialiasing. 1935 /// However, because there is no one alpha value for each pixel, ClearType is not suitable 1936 /// rendering text onto a transparent intermediate bitmap. 1937 /// </summary> 1938 DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE, 1939 1940 /// <summary> 1941 /// Grayscale antialiasing computes one coverage value for each pixel. Because the alpha 1942 /// value of each pixel is well-defined, text can be rendered onto a transparent bitmap, 1943 /// which can then be composited with other content. Note that grayscale rendering with 1944 /// IDWriteBitmapRenderTarget1 uses premultiplied alpha. 1945 /// </summary> 1946 DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE 1947 } 1948 1949 /// <summary> 1950 /// Encapsulates a 32-bit device independent bitmap and device context, which can be used for rendering glyphs. 1951 /// </summary> 1952 mixin( uuid!(IDWriteBitmapRenderTarget1, "791e8298-3ef3-4230-9880-c9bdecc42064") ); 1953 interface IDWriteBitmapRenderTarget1 : IDWriteBitmapRenderTarget 1954 { 1955 extern(Windows): 1956 /// <summary> 1957 /// Gets the current text antialiasing mode of the bitmap render target. 1958 /// </summary> 1959 /// <returns> 1960 /// Returns the antialiasing mode. 1961 /// </returns> 1962 DWRITE_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); 1963 1964 /// <summary> 1965 /// Sets the current text antialiasing mode of the bitmap render target. 1966 /// </summary> 1967 /// <returns> 1968 /// Returns S_OK if successful, or E_INVALIDARG if the argument is not valid. 1969 /// </returns> 1970 /// <remarks> 1971 /// The antialiasing mode of a newly-created bitmap render target defaults to 1972 /// DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE. An application can change the antialiasing 1973 /// mode by calling SetTextAntialiasMode. For example, an application might specify 1974 /// grayscale antialiasing when rendering text onto a transparent bitmap. 1975 /// </remarks> 1976 HRESULT SetTextAntialiasMode( 1977 DWRITE_TEXT_ANTIALIAS_MODE antialiasMode 1978 ); 1979 }